<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>天众供应链云仓储管理系统</title>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/bootstrap/css/bootstrap-responsive.min.css">
	<script type="text/javascript" src="__PUBLIC__/Common/easyui/js/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/bootstrap/js/bootstrap.min.js"></script>
<style>
body, th, td, button, input, select, textarea {
    font-family: "Microsoft Yahei","Hiragino Sans GB","Helvetica Neue",Helvetica,tahoma,arial,"WenQuanYi Micro Hei",Verdana,sans-serif,"\5B8B\4F53";
    font-size: 12px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.panel-default>.panel-header {
    border-color: #ddd;
    background-color: #f5f5f5;
    color: #444;
}
.panel-header {
    border-bottom: solid 1px transparent;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: 700;
}
.barcode_img{
	margin-left: 10px; margin-top: 60px;
}
@media print {
		.noprint { display: none; }
		.break {page-break-after:always;}
}
</style>
</head>
<body>
	<div class="panel panel-default">
		<div class="panel-header bg-success noprint">条形码生成规则：当前仓库企业编码({$warehouse_code})+区号({$area_code})+日期({$datetime})+流水号(00001-99999)</div>
		<div class="panel-body">
			<table class="table table-border table-bordered noprint">
				<tbody>
				<tr>
					<td>生成张数：<input style="width: 300px;" class="input-text radius size-XL" name="text" type="text"></td>
				</tr>
				<tr>
					<td>条形码高度：<input style="width:300px; outline: none; border: none;" name="size" type="range" class="input-text size-XL"></td>
				</tr>
				<tr>
					<td>条形码长度：<input style="width:300px; outline: none; border: none;" value="25" name="sizefactor" type="range" class="input-text size-XL"></td>
				</tr>
				<tr>
					<td>字体大小：<input style="width:300px; outline: none; border: none;" value="16" name="font_size" type="range" class="input-text size-XL"></td>
				</tr>
				<tr>
					<td colspan="2"><input type="button" id="make_barcode" value="生成条形码" class="btn btn-primary radius size-XL">
					<input type="button" id="print" value="打印条码" class="btn btn-primary radius size-XL">
					</td>
				</tr>
			</tbody></table>
			<div id="barcode_bat">
				
			</div>
			
		</div>
	</div>
<script>
	$("#print").on("click",function(){
		<!-- console.log($('#barcode_bat').html()); -->
		<!-- var body=$('body').html(); -->
		<!-- $('body').html("<div>"+$('#barcode_bat').html()+"</div>"); -->
		window.print();
		<!-- $('body').html(body); -->
	});
    $("#make_barcode").click(function () {
        if ($("input[name=text]").val() > 100) {
            alert('输入不要大于100');
            return false;
        }
        var sizef = $("input[name=sizefactor]").val() / 20;
        var font_size = $("input[name=font_size]").val() / 2+12;
        <!-- var url = "/index.php/Tool/create_barcode?" + 'size=' + $("input[name=size]").val() + '&text=' + $("input[name=text]").val() + '&sizefactor=' + sizef+'&font_size='+font_size; -->
		
		$.ajax({
            type:"post",
            url:"{:U('MakeBarcode')}",
			data:{nums:$("input[name=text]").val()},
            success: function(result){
            	for(i=0;i<result.length;i++){
					var url = "./index.php/Tool/create_barcode?" + 'size=' + $("input[name=size]").val() + '&text=' + result[i] + '&sizefactor=' + sizef+'&font_size='+font_size;
					$('#barcode_bat').append('<img class="barcode_img" src="'+url+'">');
				}
            }
        });
        
    });
</script>
</body>
</html>